<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2019-07-01
  Time: 13:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String pash = request.getContextPath();
    String basepash = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + pash + "/";
%>
<html>
<head>
    <base href="<%=basepash%>">
    <%@include file="/publs.jsp"%>
    <title>Title</title>
</head>
<body>
<div id="root">
    <Row  style="margin-left:50px;margin-top: 10px;">
        <i-col>
            <i-form :label-width="80" :inline="true">
                <form-item label="进/退">
                    <i-select style="width: 150px" v-model="spuid">
                        <i-option value="请选择">请选择</i-option>
                        <i-option value="进货">进货</i-option>
                        <i-option value="退货">退货</i-option>
                    </i-select>
                </form-item>
                <form-item label="采购员">
                    <i-select style="width: 150px" v-model="idss">
                        <i-option :value="-1">请选择</i-option>
                        <i-option v-for="item in asdasdadasdsa" v-if="item.posi=='采购员'" :value="item.id">{{item.anames}}</i-option>
                    </i-select>
                </form-item>
                <form-item label="质检员">
                    <i-select style="width: 150px" v-model="ids">
                        <i-option :value="-1">请选择</i-option>
                        <i-option v-for="item in asdasdadasdsa" v-if="item.posi=='质检员'" :value="item.id">{{item.anames}}</i-option>
                    </i-select>
                </form-item>
                <%--<i-button icon="ios-search" @click="qingkong">清空</i-button>--%>
                <i-button type="primary" icon="ios-search" @click="chaxubn">查询</i-button>
            </i-form>
        </i-col>
    </Row>

    <Row style="margin: 20px;margin-top: -20px">

        <i-col>
            <i-table :height="heights" style="margin-top:20px;margin-right: 50px;" :data="datasasd" :columns="colunmsss" border>
                <template slot="caozuo" slot-scope="{row}">
                    <i-button size="small" type="primary" @click="chakan(row)" icon="md-albums">查看</i-button>
                </template>
                <template slot="caigouzhuantai" slot-scope="{row}">
                    <%--{{row.purstate=="0"?"未审核":"已审核"}}--%>
                    <span v-if="row.dingdanStar=='3'">批准(可以采购)</span>
                    <span v-if="row.dingdanStar=='4'">不批准</span>
                    <span v-if="row.dingdanStar=='5'">采购完毕</span>
                    <span v-if="row.dingdanStar=='1'">未提交</span>
                    <span v-if="row.dingdanStar=='2'">已提交</span>
                    <span v-if="row.qualState=='1'">未入库</span>
                    <span v-if="row.qualState=='2'">已入库</span>


                    <%--<span v-if="row.qualState=='1'&&row.purstate!='0'&&row.comment=='3'">:未入库</span>--%>
                    <%--<span v-if="row.qualState=='1'&&row.purstate!='0'&&row.comment=='4'">:已入库</span>--%>
                </template>
                <template slot="caigoujinjiputong" slot-scope="{row}">
                    {{row.purjistate=="0"?"普通":"紧急"}}
                </template>
            </i-table>
            <page :total="totals"  @on-change="onchenge" :page-Size="pageSize" show-sizer :page-size-opts="[5,10,15,20]" @on-page-size-change="onPageSizeChange"></page>
        </i-col>
    </Row>
</div>
<script>
    let _this = null;
    new Vue({
        el:"#root",
        data:{
            asdasdadasdsa:[],
            datasasd:[],
            pageNo:0,
            totals:20,
            colunmsss:[
                {
                    title:"采购员",
                    key:"anames"
                },{
                    title:"状态",
                    key:"purstate",
                    slot:"caigouzhuantai"
                },{
                    title:"紧急/普通",
                    key:"purjistate",
                    slot:"caigoujinjiputong"
                },{
                    title:"质检描述",
                    key:"qualComment",
                    tooltip:true
                },{
                    title:"质检人",
                    key:"zhijianren",
                },{
                    title:"录入时间",
                    key:"atime",
                    sortable: true
                },{
                    title:"操作",
                    slot:"caozuo"
                }
            ],
            heights:700,
            pageSize:20,
            spuid:"",
            idss:0,
            ids:0,
            total:10,

        },
        methods:{
            onchenge(size){
                this.pageNo = size;
                this.chaxunselectcaigoudingan();
            },
            onPageSizeChange(size){
                this.pageSize = size;
                this.chaxunselectcaigoudingan();
            },
            chaxunselectcaigoudingan(){
                axios.get("/chaxunselectcaigoudinganssssssssssss?pageNo="+this.pageNo+"&pageSize="+this.pageSize+"&spuid="+this.spuid+"&id="+this.idss+"&ids="+_this.ids).then(({data})=>{
                    this.datasasd = data.obj.list;
                    this.heights = data.obj.list.length*48+40;
                    if(this.heights==0){
                        this.heights = 100;
                    }
                    this.totals = data.obj.tatle;
                })
            },
            chakan(row){
                location.href='/zhuangeanye?ids='+row.cgoId+"&a=3";
            },
            selectzhijianyuancaigouyuan(){
                axios.get("/users/userAll").then(({data})=>{
                    this.asdasdadasdsa = data.obj;
                })
            },
            chaxubn(){
                this.chaxunselectcaigoudingan();
            }

        },
        mounted(){
            this.chaxunselectcaigoudingan();
            this.selectzhijianyuancaigouyuan()
        },
        created(){
            _this = this;
        }
    })
</script>
</body>
</html>
